home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
015a
/
xset20.zip
/
XSET.DOC
< prev
next >
Wrap
Text File
|
1992-01-29
|
11KB
|
333 lines
┌────────────────────────────────────────────────────────────┐
│ ENHANCED SET INSTRUCTION 2.0 - (C) 1992 STERN Marc │
└────────────────────────────────────────────────────────────┘
All you always wanted to put in an environment variable and
never dare to ask DOS for...
XSET: The way to easily write efficient batch files.
XSET allows you to put EVERYTHING you want in a variable of
the current environment and use it as if you gave it the value with
the standard DOS command 'SET'. You will be able to write very efficient
batch files including string manipulation, calculation,...
XSET is the more powerful environment variable manipulation
program you never saw. It also has the easiest and most intuitive
user interface it is possible to write.
XSET is fully compatible with MS-DOS 5.0, DR-DOS 6.0, NDOS & 4DOS 4.0 .
XSET has five major features:
════════════════════════════
- XSET permits to catch the output of any command (internal or external)
or program and put it into an environment variable.
- XSET has several built-in commands to modify the output of a program
or a string given on the command-line (extract a part of a string,...)
- XSET has a built-in full floating-point calculation functionalitie:
──────────────────────────────────────────────
You can make incremental loops, input a calculation string and
output a number,...
- XSET can manage variable contents of more than 128 characters
(your path can now be as long as you want)
- XSET has some other built-in commands to give you access to some
system datas (date, time, ...)
* type XSET with no parameters to have the full description
of all functionalities (parameters and effects).
Example of use:
══════════════
Rem: in all the examples, the command XSET and the its built-in commands
are typed in uppercase and the environment variables names are
in lowercase. This is only for readability; when you type it,
you may mix lowercases and uppercase as you want.
The case is only significant for arguments strings you enter on the
command-line.
The 'C:>' represents your prompt, do not type it!
1) C:> XSET datvar DATE
Puts the date into the variable 'datvar'
Type the command SET and you will see all the environment variables:
...
COMSPEC=...
DATVAR=dd-mm-yy (where dd,mm,yy are replaced by current
day, month and year)
...
You can now use the variable 'datvar' in a batch file:
ECHO the date is %datvar%
2) C:> XSET name INPUT "Enter your name: "
Inputs a string from the keyboard (usual answer terminated by <Enter>)
and puts it into the variable 'name'.
You can now use the variable 'name' in a batch file to enter
personal environment for each user:
ECHO Hello %name%, beginning the work
CD \%name%
3) C:> CD | XSET dirname
Puts the output of the command 'CD' (i.e. the current directory name)
into the variable 'dirname'.
You can write a batch file to go to another directory, execute
a program and come back into the current one
rem ------------------
CD | XSET dirname
CD \otherdir
myprog ...
cd %dirname%
set dirname=
rem ------------------
4) You can write a batch file with automatic loops
rem ------------------
set loop=1
:next
if %loop% == 20 goto end
.......
anything you want
.......
XSET loop MATH %loop% + 1
goto next
:end
rem ------------------
5) You can write a batch file where the user may enter
a calculation and use it as a number
rem ------------------
XSET calc INPUT "Enter your calculation: "
XSET result MATH %calc%
echo %calc% = %result%
rem ------------------
6) More complex example of a login procedure
rem ---------------------- LOGIN.BAT --------------------------------
echo off
cls
rem Ask login name from keyboard
rem ----------------------------
XSET login INPUT "Enter login name : "
rem Test if directory corresponding to login name already exist
rem -----------------------------------------------------------
if exist c:\%login%\nul goto LOGIN
rem Directory does not exist, ask to create it
rem ------------------------------------------
echo:
echo Login '%login%' does not exist.
echo Do you want to create it? (Y/N)
rem Only "yYnN" keys are allowed
rem ----------------------------
XSET ask KEY "yYnN"
XSET ask UPPER %ask%
if "%ask%" == "N" goto INPUT
rem Create directory
rem ----------------
md c:\%login%
:LOGIN
set ask=
cd \%login%
if exist autouser.bat autouser.bat
rem -----------------------------------------------------------------
7) And much more ...
Installation:
════════════
- XSET.EXE is ready to use; no installation,
but it is a SHAREWARE version.
- To get a registered version of XSET, print the XSET.REG file,
fill it and send it to me; you will then receive the password
mandatory to use the program REGISTER.
- if a registered people gave you the program (the shareware version
obviously), put his name to the registration formular; he will
so receive each new upgrade for free!!!
Problems:
════════
- If the size of your environment space is not big enough,
you will receive an error message
'XSET : not enough environment space.'
This is not a bug, it is because the environment space
reserved for the variables is too small.
You must increase it by modifying the line 'SHELL=...'
in your CONFIG.SYS. By default, DOS reserves 256 bytes
environment space; this is generally insufficient.
Try 640 bytes (or more if you need it) by adding '/e:640'
at the line 'SHELL=...'
ex: SHELL=COMMAND.COM /E:640 /P
Additional information: 32.2.427.98.52 (after 19h)
══════════════════════ or 32.2.465.01.19
E-mail: stern@mble.philips.be
┌────────────────────────────────────────────────────────────┐
│ ENHANCED SET INSTRUCTION 2.0 - (C) 1991 STERN Marc │
└────────────────────────────────────────────────────────────┘
Syntax: XSET <dosvar> COMMAND [args..]
Commands Arguments Action and value assigned to <dosvar>
-------- --------- -------------------------------------
INPUT [prompt] echo <prompt> and read input from standard input
ex: XSET name INPUT Enter your name:
PASSWD [prompt] same as INPUT without echoing
APPEND {string} old value + <string>
ex: XSET path APPEND ;c:\msc600\bin;c:\msc600\binb
Rem: this allow you to bypass the 128 characters
limit of DOS
KEY string key pressed (must be in <string> if not empty)
ex: XSET k KEY 123aAbB
only keys 123aAbB are allowed
ex: XSET k KEY
all are allowed
LENGTH {string} number of characters in <string>
LEFT n {string} the leftmost <n> characters of <string>
ex: XSET var LEFT 3 abcdef
puts 'abc' in variable 'var'
MID m n {string} the <n> characters in <string> starting from the <m>th
RIGHT n {string} the rightmost <n> characters of <string>
UPPER {string} uppercase <string>
LOWER {string} lowercase <string>
COUNT {string} the number of words in <string>
WORD n {string} pick the <n>-th word in <string>
LINE n read the <n>-th line from standard input
STDERR n read the <n>-th line from standard error
MATH {expr} result of calculation of expression <expr>
valid operators: + - * / () on floats
+ - * / () %% on integers
ex: XSET var MATH 3+(2*5) + %new%
MIN ┌{str1...strn} minimum or maximum of numbers or strings list
MAX └{num1...numn} (one string may not contain <space> or <tab>)
ex: XSET var MIN 3.6 4 9.02
ex: XSET var MAX 3.6 4 abc 3.9j
DATE system date (dd-mm-yy)
DAY day of the month (1-31)
MONTH month number (1-12)
YEAR system year (4 digits)
TIME system time (hh:mm:ss - 24h format)
HOUR system hour (0-24)
MINUTE system minutes (0-59)
SEC system seconds (0-59)
DENSITY drive drive density (360, 720, 1200, 1440 or 0)
DIR [drive] current directory of <drive> or current drive
FPATH {file} full pathname of a filename
FDRIVE {file} drive of a filename
FDIR {file} drive & directory of a filename
FEXT {file} extension of a file name (no period included)
FNAME {file} name of a file without extension
FXNAME {file} name & extension of a file
FSIZE {file} size of a file
TRUENAME {file} full truename of a file
[...] are optional arguments.
If arguments {...} are missing, they are read from the standard input.
Non quoted arguments on command-line will be separated by 1 blank.
Rem: 'XSET var' is equivalent to 'XSET var INPUT'
or 'XSET var LINE 1'
and is more performant.